function showGrow()
{
    $.post("show",{},function(data){
        var jsonObj = $.parseJSON(data);      
        var jsonDatas = jsonObj.data;
        var jsons = [];
        var jsonw = [];
        var times = [];
        $('#chart').html('');
        $('#chartdiv').html('');
        for(var i=0;i<jsonDatas.length;i++ )
        {
            jsons.push(jsonDatas[i]['height']);
            jsonw.push(jsonDatas[i]['weight']);
            times.push(jsonDatas[i]['time']);
        }
         $.jqplot('chart',  [jsons],{
            title:'身高生长曲线',
            axisDefaults: {
                show:false,   
                  tickOptions: {
                  showMark:true       
              } //tickOptions结束
         },//axisDefaults结束
         axes: {
           yaxis:{
               show:false,
               max:200,
               min:20,
               tickOptions: { 
                  fontFamily:'CM' //刻度值上字体   
               }
           }//yaxis
         },//axes
         cursor: {
          show: true,
          tooltipLocation:'sw'
        }
   });
         $.jqplot('chartdiv', [jsonw],{
            title:'体重生长曲线',
            axisDefaults: {
                show:false,   
                tickOptions: {
                  showMark:true       
              } //tickOptions结束
         },//axisDefaults结束
         axes: {
           yaxis:{
               show:false,
               max:90,
               min:0,
           }
         },
          cursor: {
          show: true,
          tooltipLocation:'sw'
        }
       });
         
   });
  
}
 function selectitem(index){
   switch(index){
    case 0:
    window.location.href="{:U('Public/tohome')}"
    break;
    case 1:
    window.location.href="{:U('Upload/uploadpicture')}"
    break;
    case 2:
    window.location.href="{:U('Note/addBlog')}"
    break;
    case 3:
    window.location.href="{:U('First/Index')}"
    break;
    case 4:
    window.location.href="{:U('Favorite/Index')}"
    break;
    case 5:
    window.location.href="{:U('Video/addVideo')}"
    break;
    case 6:
    window.location.href="{:U('Growth/Index')}"
    break;
    case 7:
    window.location.href="{:U('Timeshow/Index')}"
    break;
   }
}

function update()
{
   
    var height = $('#height').val();
    var weight = $('#weight').val();
    $.post("addShow",{height:height,weight:weight},function(data){
      
        $('#height').css('value','');
        $('#weight').css('value','');
        var jsonObj = $.parseJSON(data);      
        var jsonDatas = jsonObj.data;
        var jsons = [];
        var jsonw = [];
        var times = [];
        $('#chart').html('');
        $('#chartdiv').html('');
        for(var i=0;i<jsonDatas.length;i++ )
        {
            jsons.push(jsonDatas[i]['height']);
            jsonw.push(jsonDatas[i]['weight']);
            times.push(jsonDatas[i]['time']);
        }
          alert(jsonw);
          $.jqplot('chart',  [jsons],{
            title:'身高生长曲线',
            axisDefaults: {
                show:false,   
          //      ticks:[2012-1-3,2012-1-7,2012-1-17,2012-1-27,2012-2-7,2012-2-17,2012-2-27,2012-3-7,2012-3-17,2012-3-27],
                tickOptions: {
                  showMark:true       
              } //tickOptions结束
         },//axisDefaults结束
         axes: {
         //  xaxis:{
//             renderer: $.jqplot.dateAxisRenderer,
//             tickOptions:{
//                formatString:'%b %#d, %Y',
//                fontFamily:'date', //刻度值上字体   
//                angle:40  
//             }   
//           },
           yaxis:{
               show:false,
               max:200,
               min:20,
               tickOptions: { 
                  fontFamily:'CM' //刻度值上字体   
               }
           }//yaxis
         },//axes
         cursor: {
          show: true,
          tooltipLocation:'sw'
        }
   });
         $.jqplot('chartdiv', [jsonw],{
            title:'体重生长曲线',
            axisDefaults: {
                show:false,   
                tickOptions: {
                  showMark:true       
              } //tickOptions结束
         },//axisDefaults结束
         axes: {
           yaxis:{
               show:false,
               max:90,
               min:0,
           }
         },
          cursor: {
          show: true,
          tooltipLocation:'sw'
        }
       });
         
   });
  
}

function checknumber1()
{
    var height = $('#height').val();
    if(height<20||height>200){
      $('#testNum1').css('display','block');
      $('#testNum1').html('身高输入数据过大或过小！');   
    }
    if(isNaN(height)){
      $('#testNum1').css('display','block');
      $('#testNum1').html('请输入数字');  
    }
}

function checknumber2()
{
    var weight = $('#weight').val();  
    if(isNaN(weight)){
      $('#testNum2').css('display','block');
      $('#testNum2').html('体重请输入数字');  
    }
    if(weight<0||weight>90){
      $('#testNum2').css('display','block');
      $('#testNum2').html('体重输入数据过大或过小，请注意单位为KG');   
    }
}
function clearnumber1()
{
    $('#height').attr('value','');
    $('#testNum1').html('');
    $('#testNum1').css('display','none');
}
function clearnumber2()
{
    $('#weight').attr('value','');
    $('#testNum2').html('');
    $('#testNum2').css('display','none');
}